{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>答题序号</th>\n",
       "      <th>来源</th>\n",
       "      <th>Q1_您的性别</th>\n",
       "      <th>Q2_您的年龄</th>\n",
       "      <th>Q3_您的学历</th>\n",
       "      <th>Q4_您的家庭年收入水平</th>\n",
       "      <th>Q5_您是否有处于中小学教育阶段的子女</th>\n",
       "      <th>Q6_处于中小学教育阶段子女的学籍所在地</th>\n",
       "      <th>Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？</th>\n",
       "      <th>Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？</th>\n",
       "      <th>...</th>\n",
       "      <th>Q29_您是否认可当地“双减”政策推行的力度</th>\n",
       "      <th>Q30_您对双减政策的未来期望是什么？</th>\n",
       "      <th>开始时间</th>\n",
       "      <th>提交时间</th>\n",
       "      <th>答题时长</th>\n",
       "      <th>IP省份</th>\n",
       "      <th>IP城市</th>\n",
       "      <th>IP地址</th>\n",
       "      <th>浏览器</th>\n",
       "      <th>操作系统</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>上海市|上海城区</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>没有</td>\n",
       "      <td>2022-02-20 10:09:26</td>\n",
       "      <td>2022-02-20 10:13:05</td>\n",
       "      <td>03分39秒</td>\n",
       "      <td>上海市</td>\n",
       "      <td>上海市</td>\n",
       "      <td>183.193.63.85</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>大专</td>\n",
       "      <td>1万以内</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>7</td>\n",
       "      <td>政策越来越完善</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:27</td>\n",
       "      <td>03分01秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>杭州市</td>\n",
       "      <td>36.18.246.241</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|广州市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:35</td>\n",
       "      <td>03分09秒</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>117.136.40.146</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>E_307_614dbddf1b24253e3cd9696a_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|沈阳市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>严查上有政策，下有对策行为。</td>\n",
       "      <td>2022-02-20 10:09:29</td>\n",
       "      <td>2022-02-20 10:14:09</td>\n",
       "      <td>04分40秒</td>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>双鸭山市</td>\n",
       "      <td>113.5.16.14</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8</td>\n",
       "      <td>E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|丹东市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>4</td>\n",
       "      <td>加大校外培训机构整顿</td>\n",
       "      <td>2022-02-20 10:11:10</td>\n",
       "      <td>2022-02-20 10:14:13</td>\n",
       "      <td>03分03秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>湖州市</td>\n",
       "      <td>101.70.139.26</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1683</th>\n",
       "      <td>465</td>\n",
       "      <td>E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>8-15万</td>\n",
       "      <td>是</td>\n",
       "      <td>河北省|石家庄市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>4</td>\n",
       "      <td>教育公平</td>\n",
       "      <td>2022-02-17 21:50:24</td>\n",
       "      <td>2022-02-17 21:58:37</td>\n",
       "      <td>08分13秒</td>\n",
       "      <td>河北省</td>\n",
       "      <td>邯郸市</td>\n",
       "      <td>106.115.8.250</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1684</th>\n",
       "      <td>466</td>\n",
       "      <td>E_307_61bd8fa633f0c464c8728b52_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>江西省|景德镇市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>4</td>\n",
       "      <td>...</td>\n",
       "      <td>4</td>\n",
       "      <td>双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。</td>\n",
       "      <td>2022-02-17 21:50:34</td>\n",
       "      <td>2022-02-17 21:58:48</td>\n",
       "      <td>08分14秒</td>\n",
       "      <td>江西省</td>\n",
       "      <td>景德镇市</td>\n",
       "      <td>120.206.172.48</td>\n",
       "      <td>Chrome 55.0.2883.91</td>\n",
       "      <td>Android Linux 7.1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1685</th>\n",
       "      <td>467</td>\n",
       "      <td>E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>1-3万</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>孩子有好出路</td>\n",
       "      <td>2022-02-17 21:50:18</td>\n",
       "      <td>2022-02-17 21:59:02</td>\n",
       "      <td>08分44秒</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>南宁市</td>\n",
       "      <td>223.104.91.105</td>\n",
       "      <td>Chrome 65.0.3325.110</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1686</th>\n",
       "      <td>468</td>\n",
       "      <td>E_307_61a61a311b2425a6c5458a3e_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|深圳市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>更加完善</td>\n",
       "      <td>2022-02-17 21:49:19</td>\n",
       "      <td>2022-02-17 21:59:27</td>\n",
       "      <td>10分08秒</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.144.3.73</td>\n",
       "      <td>Chrome 83.0.4103.106</td>\n",
       "      <td>Android Linux 11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1687</th>\n",
       "      <td>472</td>\n",
       "      <td>E_307_614be6af33f0c42c522c9d0d_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>30-100万</td>\n",
       "      <td>是</td>\n",
       "      <td>四川省|成都市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>4</td>\n",
       "      <td>孩子可以上好的大学</td>\n",
       "      <td>2022-02-17 21:41:47</td>\n",
       "      <td>2022-02-17 22:05:27</td>\n",
       "      <td>23分40秒</td>\n",
       "      <td>四川省</td>\n",
       "      <td>成都市</td>\n",
       "      <td>223.104.9.150</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1688 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      答题序号                                       来源 Q1_您的性别 Q2_您的年龄 Q3_您的学历  \\\n",
       "0        1  E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM       女   40-50      本科   \n",
       "1        2  E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM       男   29-39      大专   \n",
       "2        4  E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM       男   40-50      本科   \n",
       "3        7  E_307_614dbddf1b24253e3cd9696a_4gDO4ETM       女   29-39      本科   \n",
       "4        8  E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM       女   29-39   高中及以下   \n",
       "...    ...                                      ...     ...     ...     ...   \n",
       "1683   465  E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM       男   29-39      本科   \n",
       "1684   466  E_307_61bd8fa633f0c464c8728b52_yIzN3ETM       女   29-39   高中及以下   \n",
       "1685   467  E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM       女   29-39      本科   \n",
       "1686   468  E_307_61a61a311b2425a6c5458a3e_yIzN3ETM       女   29-39      本科   \n",
       "1687   472  E_307_614be6af33f0c42c522c9d0d_yIzN3ETM       女   29-39      本科   \n",
       "\n",
       "     Q4_您的家庭年收入水平 Q5_您是否有处于中小学教育阶段的子女 Q6_处于中小学教育阶段子女的学籍所在地  \\\n",
       "0          15-30万                   是             上海市|上海城区   \n",
       "1            1万以内                   是              河南省|洛阳市   \n",
       "2          15-30万                   是              广东省|广州市   \n",
       "3          15-30万                   是              辽宁省|沈阳市   \n",
       "4            3-8万                   是              辽宁省|丹东市   \n",
       "...           ...                 ...                  ...   \n",
       "1683        8-15万                   是             河北省|石家庄市   \n",
       "1684         3-8万                   是             江西省|景德镇市   \n",
       "1685         1-3万                   是              河南省|洛阳市   \n",
       "1686       15-30万                   是              广东省|深圳市   \n",
       "1687      30-100万                   是              四川省|成都市   \n",
       "\n",
       "     Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？  \\\n",
       "0                                          5-10%   \n",
       "1                                          5-10%   \n",
       "2                                           0-5%   \n",
       "3                                           0-5%   \n",
       "4                                        0%（无补课）   \n",
       "...                                          ...   \n",
       "1683                                     0%（无补课）   \n",
       "1684                                     10%-20%   \n",
       "1685                                     0%（无补课）   \n",
       "1686                                     10%-20%   \n",
       "1687                                     10%-20%   \n",
       "\n",
       "      Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？  ...  \\\n",
       "0                                                    6  ...   \n",
       "1                                                    7  ...   \n",
       "2                                                    6  ...   \n",
       "3                                                    6  ...   \n",
       "4                                                    6  ...   \n",
       "...                                                ...  ...   \n",
       "1683                                                 6  ...   \n",
       "1684                                                 4  ...   \n",
       "1685                                                 5  ...   \n",
       "1686                                                 6  ...   \n",
       "1687                                                 6  ...   \n",
       "\n",
       "      Q29_您是否认可当地“双减”政策推行的力度                    Q30_您对双减政策的未来期望是什么？  \\\n",
       "0                          6                                     没有   \n",
       "1                          7                                政策越来越完善   \n",
       "2                          5                                    NaN   \n",
       "3                          5                         严查上有政策，下有对策行为。   \n",
       "4                          4                             加大校外培训机构整顿   \n",
       "...                      ...                                    ...   \n",
       "1683                       4                                   教育公平   \n",
       "1684                       4  双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。   \n",
       "1685                       6                                 孩子有好出路   \n",
       "1686                       6                                   更加完善   \n",
       "1687                       4                              孩子可以上好的大学   \n",
       "\n",
       "                     开始时间                 提交时间    答题时长     IP省份  IP城市  \\\n",
       "0     2022-02-20 10:09:26  2022-02-20 10:13:05  03分39秒      上海市   上海市   \n",
       "1     2022-02-20 10:10:26  2022-02-20 10:13:27  03分01秒      浙江省   杭州市   \n",
       "2     2022-02-20 10:10:26  2022-02-20 10:13:35  03分09秒      广东省   广州市   \n",
       "3     2022-02-20 10:09:29  2022-02-20 10:14:09  04分40秒     黑龙江省  双鸭山市   \n",
       "4     2022-02-20 10:11:10  2022-02-20 10:14:13  03分03秒      浙江省   湖州市   \n",
       "...                   ...                  ...     ...      ...   ...   \n",
       "1683  2022-02-17 21:50:24  2022-02-17 21:58:37  08分13秒      河北省   邯郸市   \n",
       "1684  2022-02-17 21:50:34  2022-02-17 21:58:48  08分14秒      江西省  景德镇市   \n",
       "1685  2022-02-17 21:50:18  2022-02-17 21:59:02  08分44秒  广西壮族自治区   南宁市   \n",
       "1686  2022-02-17 21:49:19  2022-02-17 21:59:27  10分08秒      NaN   NaN   \n",
       "1687  2022-02-17 21:41:47  2022-02-17 22:05:27  23分40秒      四川省   成都市   \n",
       "\n",
       "                IP地址                   浏览器                 操作系统  \n",
       "0      183.193.63.85  Chrome 86.0.4240.198            Windows 7  \n",
       "1      36.18.246.241   Chrome 88.0.4324.93     Android Linux 10  \n",
       "2     117.136.40.146   Chrome 86.0.4240.99  Android Linux 8.1.0  \n",
       "3        113.5.16.14   Chrome 86.0.4240.99     Android Linux 10  \n",
       "4      101.70.139.26  Chrome 86.0.4240.198            Windows 7  \n",
       "...              ...                   ...                  ...  \n",
       "1683   106.115.8.250   Chrome 88.0.4324.93     Android Linux 10  \n",
       "1684  120.206.172.48   Chrome 55.0.2883.91  Android Linux 7.1.2  \n",
       "1685  223.104.91.105  Chrome 65.0.3325.110  Android Linux 8.1.0  \n",
       "1686     39.144.3.73  Chrome 83.0.4103.106     Android Linux 11  \n",
       "1687   223.104.9.150  Chrome 86.0.4240.198           Windows 10  \n",
       "\n",
       "[1688 rows x 38 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_excel(\"./datas.xlsx\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>答题序号</th>\n",
       "      <th>来源</th>\n",
       "      <th>Q1_您的性别</th>\n",
       "      <th>Q2_您的年龄</th>\n",
       "      <th>Q3_您的学历</th>\n",
       "      <th>Q4_您的家庭年收入水平</th>\n",
       "      <th>Q5_您是否有处于中小学教育阶段的子女</th>\n",
       "      <th>Q6_处于中小学教育阶段子女的学籍所在地</th>\n",
       "      <th>Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？</th>\n",
       "      <th>Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？</th>\n",
       "      <th>...</th>\n",
       "      <th>Q30_您对双减政策的未来期望是什么？</th>\n",
       "      <th>开始时间</th>\n",
       "      <th>提交时间</th>\n",
       "      <th>答题时长</th>\n",
       "      <th>IP省份</th>\n",
       "      <th>IP城市</th>\n",
       "      <th>IP地址</th>\n",
       "      <th>浏览器</th>\n",
       "      <th>操作系统</th>\n",
       "      <th>area</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>上海市|上海城区</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>没有</td>\n",
       "      <td>2022-02-20 10:09:26</td>\n",
       "      <td>2022-02-20 10:13:05</td>\n",
       "      <td>03分39秒</td>\n",
       "      <td>上海市</td>\n",
       "      <td>上海市</td>\n",
       "      <td>183.193.63.85</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>大专</td>\n",
       "      <td>1万以内</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>政策越来越完善</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:27</td>\n",
       "      <td>03分01秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>杭州市</td>\n",
       "      <td>36.18.246.241</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>河南省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|广州市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:35</td>\n",
       "      <td>03分09秒</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>117.136.40.146</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>E_307_614dbddf1b24253e3cd9696a_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|沈阳市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>严查上有政策，下有对策行为。</td>\n",
       "      <td>2022-02-20 10:09:29</td>\n",
       "      <td>2022-02-20 10:14:09</td>\n",
       "      <td>04分40秒</td>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>双鸭山市</td>\n",
       "      <td>113.5.16.14</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>辽宁省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8</td>\n",
       "      <td>E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|丹东市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>加大校外培训机构整顿</td>\n",
       "      <td>2022-02-20 10:11:10</td>\n",
       "      <td>2022-02-20 10:14:13</td>\n",
       "      <td>03分03秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>湖州市</td>\n",
       "      <td>101.70.139.26</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "      <td>辽宁省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1683</th>\n",
       "      <td>465</td>\n",
       "      <td>E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>8-15万</td>\n",
       "      <td>是</td>\n",
       "      <td>河北省|石家庄市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>教育公平</td>\n",
       "      <td>2022-02-17 21:50:24</td>\n",
       "      <td>2022-02-17 21:58:37</td>\n",
       "      <td>08分13秒</td>\n",
       "      <td>河北省</td>\n",
       "      <td>邯郸市</td>\n",
       "      <td>106.115.8.250</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1684</th>\n",
       "      <td>466</td>\n",
       "      <td>E_307_61bd8fa633f0c464c8728b52_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>江西省|景德镇市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>4</td>\n",
       "      <td>...</td>\n",
       "      <td>双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。</td>\n",
       "      <td>2022-02-17 21:50:34</td>\n",
       "      <td>2022-02-17 21:58:48</td>\n",
       "      <td>08分14秒</td>\n",
       "      <td>江西省</td>\n",
       "      <td>景德镇市</td>\n",
       "      <td>120.206.172.48</td>\n",
       "      <td>Chrome 55.0.2883.91</td>\n",
       "      <td>Android Linux 7.1.2</td>\n",
       "      <td>江西省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1685</th>\n",
       "      <td>467</td>\n",
       "      <td>E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>1-3万</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>孩子有好出路</td>\n",
       "      <td>2022-02-17 21:50:18</td>\n",
       "      <td>2022-02-17 21:59:02</td>\n",
       "      <td>08分44秒</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>南宁市</td>\n",
       "      <td>223.104.91.105</td>\n",
       "      <td>Chrome 65.0.3325.110</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "      <td>河南省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1686</th>\n",
       "      <td>468</td>\n",
       "      <td>E_307_61a61a311b2425a6c5458a3e_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|深圳市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>更加完善</td>\n",
       "      <td>2022-02-17 21:49:19</td>\n",
       "      <td>2022-02-17 21:59:27</td>\n",
       "      <td>10分08秒</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.144.3.73</td>\n",
       "      <td>Chrome 83.0.4103.106</td>\n",
       "      <td>Android Linux 11</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1687</th>\n",
       "      <td>472</td>\n",
       "      <td>E_307_614be6af33f0c42c522c9d0d_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>30-100万</td>\n",
       "      <td>是</td>\n",
       "      <td>四川省|成都市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>孩子可以上好的大学</td>\n",
       "      <td>2022-02-17 21:41:47</td>\n",
       "      <td>2022-02-17 22:05:27</td>\n",
       "      <td>23分40秒</td>\n",
       "      <td>四川省</td>\n",
       "      <td>成都市</td>\n",
       "      <td>223.104.9.150</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 10</td>\n",
       "      <td>四川省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1688 rows × 39 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      答题序号                                       来源 Q1_您的性别 Q2_您的年龄 Q3_您的学历  \\\n",
       "0        1  E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM       女   40-50      本科   \n",
       "1        2  E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM       男   29-39      大专   \n",
       "2        4  E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM       男   40-50      本科   \n",
       "3        7  E_307_614dbddf1b24253e3cd9696a_4gDO4ETM       女   29-39      本科   \n",
       "4        8  E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM       女   29-39   高中及以下   \n",
       "...    ...                                      ...     ...     ...     ...   \n",
       "1683   465  E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM       男   29-39      本科   \n",
       "1684   466  E_307_61bd8fa633f0c464c8728b52_yIzN3ETM       女   29-39   高中及以下   \n",
       "1685   467  E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM       女   29-39      本科   \n",
       "1686   468  E_307_61a61a311b2425a6c5458a3e_yIzN3ETM       女   29-39      本科   \n",
       "1687   472  E_307_614be6af33f0c42c522c9d0d_yIzN3ETM       女   29-39      本科   \n",
       "\n",
       "     Q4_您的家庭年收入水平 Q5_您是否有处于中小学教育阶段的子女 Q6_处于中小学教育阶段子女的学籍所在地  \\\n",
       "0          15-30万                   是             上海市|上海城区   \n",
       "1            1万以内                   是              河南省|洛阳市   \n",
       "2          15-30万                   是              广东省|广州市   \n",
       "3          15-30万                   是              辽宁省|沈阳市   \n",
       "4            3-8万                   是              辽宁省|丹东市   \n",
       "...           ...                 ...                  ...   \n",
       "1683        8-15万                   是             河北省|石家庄市   \n",
       "1684         3-8万                   是             江西省|景德镇市   \n",
       "1685         1-3万                   是              河南省|洛阳市   \n",
       "1686       15-30万                   是              广东省|深圳市   \n",
       "1687      30-100万                   是              四川省|成都市   \n",
       "\n",
       "     Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？  \\\n",
       "0                                          5-10%   \n",
       "1                                          5-10%   \n",
       "2                                           0-5%   \n",
       "3                                           0-5%   \n",
       "4                                        0%（无补课）   \n",
       "...                                          ...   \n",
       "1683                                     0%（无补课）   \n",
       "1684                                     10%-20%   \n",
       "1685                                     0%（无补课）   \n",
       "1686                                     10%-20%   \n",
       "1687                                     10%-20%   \n",
       "\n",
       "      Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？  ...  \\\n",
       "0                                                    6  ...   \n",
       "1                                                    7  ...   \n",
       "2                                                    6  ...   \n",
       "3                                                    6  ...   \n",
       "4                                                    6  ...   \n",
       "...                                                ...  ...   \n",
       "1683                                                 6  ...   \n",
       "1684                                                 4  ...   \n",
       "1685                                                 5  ...   \n",
       "1686                                                 6  ...   \n",
       "1687                                                 6  ...   \n",
       "\n",
       "                        Q30_您对双减政策的未来期望是什么？                 开始时间  \\\n",
       "0                                        没有  2022-02-20 10:09:26   \n",
       "1                                   政策越来越完善  2022-02-20 10:10:26   \n",
       "2                                       NaN  2022-02-20 10:10:26   \n",
       "3                            严查上有政策，下有对策行为。  2022-02-20 10:09:29   \n",
       "4                                加大校外培训机构整顿  2022-02-20 10:11:10   \n",
       "...                                     ...                  ...   \n",
       "1683                                   教育公平  2022-02-17 21:50:24   \n",
       "1684  双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。  2022-02-17 21:50:34   \n",
       "1685                                 孩子有好出路  2022-02-17 21:50:18   \n",
       "1686                                   更加完善  2022-02-17 21:49:19   \n",
       "1687                              孩子可以上好的大学  2022-02-17 21:41:47   \n",
       "\n",
       "                     提交时间    答题时长     IP省份  IP城市            IP地址  \\\n",
       "0     2022-02-20 10:13:05  03分39秒      上海市   上海市   183.193.63.85   \n",
       "1     2022-02-20 10:13:27  03分01秒      浙江省   杭州市   36.18.246.241   \n",
       "2     2022-02-20 10:13:35  03分09秒      广东省   广州市  117.136.40.146   \n",
       "3     2022-02-20 10:14:09  04分40秒     黑龙江省  双鸭山市     113.5.16.14   \n",
       "4     2022-02-20 10:14:13  03分03秒      浙江省   湖州市   101.70.139.26   \n",
       "...                   ...     ...      ...   ...             ...   \n",
       "1683  2022-02-17 21:58:37  08分13秒      河北省   邯郸市   106.115.8.250   \n",
       "1684  2022-02-17 21:58:48  08分14秒      江西省  景德镇市  120.206.172.48   \n",
       "1685  2022-02-17 21:59:02  08分44秒  广西壮族自治区   南宁市  223.104.91.105   \n",
       "1686  2022-02-17 21:59:27  10分08秒      NaN   NaN     39.144.3.73   \n",
       "1687  2022-02-17 22:05:27  23分40秒      四川省   成都市   223.104.9.150   \n",
       "\n",
       "                       浏览器                 操作系统  area  \n",
       "0     Chrome 86.0.4240.198            Windows 7   上海市  \n",
       "1      Chrome 88.0.4324.93     Android Linux 10   河南省  \n",
       "2      Chrome 86.0.4240.99  Android Linux 8.1.0   广东省  \n",
       "3      Chrome 86.0.4240.99     Android Linux 10   辽宁省  \n",
       "4     Chrome 86.0.4240.198            Windows 7   辽宁省  \n",
       "...                    ...                  ...   ...  \n",
       "1683   Chrome 88.0.4324.93     Android Linux 10   河北省  \n",
       "1684   Chrome 55.0.2883.91  Android Linux 7.1.2   江西省  \n",
       "1685  Chrome 65.0.3325.110  Android Linux 8.1.0   河南省  \n",
       "1686  Chrome 83.0.4103.106     Android Linux 11   广东省  \n",
       "1687  Chrome 86.0.4240.198           Windows 10   四川省  \n",
       "\n",
       "[1688 rows x 39 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['area']= df.iloc[:,7].apply(lambda x: x.split('|')[0])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "df_ipa=df.iloc[:,[9,10,11,12,23,24,25,-1]].groupby(['area']).mean()\n",
    "df_ipa['q'] = df_ipa.apply(lambda x: np.mean(x[0:4]),axis=1)\n",
    "df_ipa['m'] = df_ipa.apply(lambda x: np.mean(x[4:7]),axis=1)\n",
    "df_ipa.to_csv('./ipa.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>答题序号</th>\n",
       "      <th>来源</th>\n",
       "      <th>Q1_您的性别</th>\n",
       "      <th>Q2_您的年龄</th>\n",
       "      <th>Q3_您的学历</th>\n",
       "      <th>Q4_您的家庭年收入水平</th>\n",
       "      <th>Q5_您是否有处于中小学教育阶段的子女</th>\n",
       "      <th>Q6_处于中小学教育阶段子女的学籍所在地</th>\n",
       "      <th>Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？</th>\n",
       "      <th>Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？</th>\n",
       "      <th>...</th>\n",
       "      <th>Q30_您对双减政策的未来期望是什么？</th>\n",
       "      <th>开始时间</th>\n",
       "      <th>提交时间</th>\n",
       "      <th>答题时长</th>\n",
       "      <th>IP省份</th>\n",
       "      <th>IP城市</th>\n",
       "      <th>IP地址</th>\n",
       "      <th>浏览器</th>\n",
       "      <th>操作系统</th>\n",
       "      <th>area</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>上海市|上海城区</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>没有</td>\n",
       "      <td>2022-02-20 10:09:26</td>\n",
       "      <td>2022-02-20 10:13:05</td>\n",
       "      <td>03分39秒</td>\n",
       "      <td>上海市</td>\n",
       "      <td>上海市</td>\n",
       "      <td>183.193.63.85</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>大专</td>\n",
       "      <td>1万以内</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>5-10%</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>政策越来越完善</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:27</td>\n",
       "      <td>03分01秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>杭州市</td>\n",
       "      <td>36.18.246.241</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>河南省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>40-50</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|广州市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2022-02-20 10:10:26</td>\n",
       "      <td>2022-02-20 10:13:35</td>\n",
       "      <td>03分09秒</td>\n",
       "      <td>广东省</td>\n",
       "      <td>广州市</td>\n",
       "      <td>117.136.40.146</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>E_307_614dbddf1b24253e3cd9696a_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|沈阳市</td>\n",
       "      <td>0-5%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>严查上有政策，下有对策行为。</td>\n",
       "      <td>2022-02-20 10:09:29</td>\n",
       "      <td>2022-02-20 10:14:09</td>\n",
       "      <td>04分40秒</td>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>双鸭山市</td>\n",
       "      <td>113.5.16.14</td>\n",
       "      <td>Chrome 86.0.4240.99</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>辽宁省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8</td>\n",
       "      <td>E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>辽宁省|丹东市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>加大校外培训机构整顿</td>\n",
       "      <td>2022-02-20 10:11:10</td>\n",
       "      <td>2022-02-20 10:14:13</td>\n",
       "      <td>03分03秒</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>湖州市</td>\n",
       "      <td>101.70.139.26</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 7</td>\n",
       "      <td>辽宁省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1683</th>\n",
       "      <td>465</td>\n",
       "      <td>E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM</td>\n",
       "      <td>男</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>8-15万</td>\n",
       "      <td>是</td>\n",
       "      <td>河北省|石家庄市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>教育公平</td>\n",
       "      <td>2022-02-17 21:50:24</td>\n",
       "      <td>2022-02-17 21:58:37</td>\n",
       "      <td>08分13秒</td>\n",
       "      <td>河北省</td>\n",
       "      <td>邯郸市</td>\n",
       "      <td>106.115.8.250</td>\n",
       "      <td>Chrome 88.0.4324.93</td>\n",
       "      <td>Android Linux 10</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1684</th>\n",
       "      <td>466</td>\n",
       "      <td>E_307_61bd8fa633f0c464c8728b52_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>高中及以下</td>\n",
       "      <td>3-8万</td>\n",
       "      <td>是</td>\n",
       "      <td>江西省|景德镇市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>4</td>\n",
       "      <td>...</td>\n",
       "      <td>双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。</td>\n",
       "      <td>2022-02-17 21:50:34</td>\n",
       "      <td>2022-02-17 21:58:48</td>\n",
       "      <td>08分14秒</td>\n",
       "      <td>江西省</td>\n",
       "      <td>景德镇市</td>\n",
       "      <td>120.206.172.48</td>\n",
       "      <td>Chrome 55.0.2883.91</td>\n",
       "      <td>Android Linux 7.1.2</td>\n",
       "      <td>江西省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1685</th>\n",
       "      <td>467</td>\n",
       "      <td>E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>1-3万</td>\n",
       "      <td>是</td>\n",
       "      <td>河南省|洛阳市</td>\n",
       "      <td>0%（无补课）</td>\n",
       "      <td>5</td>\n",
       "      <td>...</td>\n",
       "      <td>孩子有好出路</td>\n",
       "      <td>2022-02-17 21:50:18</td>\n",
       "      <td>2022-02-17 21:59:02</td>\n",
       "      <td>08分44秒</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>南宁市</td>\n",
       "      <td>223.104.91.105</td>\n",
       "      <td>Chrome 65.0.3325.110</td>\n",
       "      <td>Android Linux 8.1.0</td>\n",
       "      <td>河南省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1686</th>\n",
       "      <td>468</td>\n",
       "      <td>E_307_61a61a311b2425a6c5458a3e_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>15-30万</td>\n",
       "      <td>是</td>\n",
       "      <td>广东省|深圳市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>更加完善</td>\n",
       "      <td>2022-02-17 21:49:19</td>\n",
       "      <td>2022-02-17 21:59:27</td>\n",
       "      <td>10分08秒</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.144.3.73</td>\n",
       "      <td>Chrome 83.0.4103.106</td>\n",
       "      <td>Android Linux 11</td>\n",
       "      <td>广东省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1687</th>\n",
       "      <td>472</td>\n",
       "      <td>E_307_614be6af33f0c42c522c9d0d_yIzN3ETM</td>\n",
       "      <td>女</td>\n",
       "      <td>29-39</td>\n",
       "      <td>本科</td>\n",
       "      <td>30-100万</td>\n",
       "      <td>是</td>\n",
       "      <td>四川省|成都市</td>\n",
       "      <td>10%-20%</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>孩子可以上好的大学</td>\n",
       "      <td>2022-02-17 21:41:47</td>\n",
       "      <td>2022-02-17 22:05:27</td>\n",
       "      <td>23分40秒</td>\n",
       "      <td>四川省</td>\n",
       "      <td>成都市</td>\n",
       "      <td>223.104.9.150</td>\n",
       "      <td>Chrome 86.0.4240.198</td>\n",
       "      <td>Windows 10</td>\n",
       "      <td>四川省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1688 rows × 39 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      答题序号                                       来源 Q1_您的性别 Q2_您的年龄 Q3_您的学历  \\\n",
       "0        1  E_307_518a6d0bffb53a74cbbe325f_4gDO4ETM       女   40-50      本科   \n",
       "1        2  E_307_6204bb3d1b2425ff3da60fe6_4gDO4ETM       男   29-39      大专   \n",
       "2        4  E_307_518a6b93ffb53a74b7ec7c27_4gDO4ETM       男   40-50      本科   \n",
       "3        7  E_307_614dbddf1b24253e3cd9696a_4gDO4ETM       女   29-39      本科   \n",
       "4        8  E_307_61fe2a2c1b2425ff3eaa6f7e_4gDO4ETM       女   29-39   高中及以下   \n",
       "...    ...                                      ...     ...     ...     ...   \n",
       "1683   465  E_307_61cae8ce33f0c41f998d8ca0_yIzN3ETM       男   29-39      本科   \n",
       "1684   466  E_307_61bd8fa633f0c464c8728b52_yIzN3ETM       女   29-39   高中及以下   \n",
       "1685   467  E_307_5a6eb40ac1a87d55f8c817ad_yIzN3ETM       女   29-39      本科   \n",
       "1686   468  E_307_61a61a311b2425a6c5458a3e_yIzN3ETM       女   29-39      本科   \n",
       "1687   472  E_307_614be6af33f0c42c522c9d0d_yIzN3ETM       女   29-39      本科   \n",
       "\n",
       "     Q4_您的家庭年收入水平 Q5_您是否有处于中小学教育阶段的子女 Q6_处于中小学教育阶段子女的学籍所在地  \\\n",
       "0          15-30万                   是             上海市|上海城区   \n",
       "1            1万以内                   是              河南省|洛阳市   \n",
       "2          15-30万                   是              广东省|广州市   \n",
       "3          15-30万                   是              辽宁省|沈阳市   \n",
       "4            3-8万                   是              辽宁省|丹东市   \n",
       "...           ...                 ...                  ...   \n",
       "1683        8-15万                   是             河北省|石家庄市   \n",
       "1684         3-8万                   是             江西省|景德镇市   \n",
       "1685         1-3万                   是              河南省|洛阳市   \n",
       "1686       15-30万                   是              广东省|深圳市   \n",
       "1687      30-100万                   是              四川省|成都市   \n",
       "\n",
       "     Q7_近期您是否通过聘请私教或者报名辅导班给子女补课，补课支出占家庭收入的比例是多少？  \\\n",
       "0                                          5-10%   \n",
       "1                                          5-10%   \n",
       "2                                           0-5%   \n",
       "3                                           0-5%   \n",
       "4                                        0%（无补课）   \n",
       "...                                          ...   \n",
       "1683                                     0%（无补课）   \n",
       "1684                                     10%-20%   \n",
       "1685                                     0%（无补课）   \n",
       "1686                                     10%-20%   \n",
       "1687                                     10%-20%   \n",
       "\n",
       "      Q8_您在获取“双减”政策服务前，对“双减”政策减轻学生课业负担以及家长辅导负担的整体预期如何？  ...  \\\n",
       "0                                                    6  ...   \n",
       "1                                                    7  ...   \n",
       "2                                                    6  ...   \n",
       "3                                                    6  ...   \n",
       "4                                                    6  ...   \n",
       "...                                                ...  ...   \n",
       "1683                                                 6  ...   \n",
       "1684                                                 4  ...   \n",
       "1685                                                 5  ...   \n",
       "1686                                                 6  ...   \n",
       "1687                                                 6  ...   \n",
       "\n",
       "                        Q30_您对双减政策的未来期望是什么？                 开始时间  \\\n",
       "0                                        没有  2022-02-20 10:09:26   \n",
       "1                                   政策越来越完善  2022-02-20 10:10:26   \n",
       "2                                       NaN  2022-02-20 10:10:26   \n",
       "3                            严查上有政策，下有对策行为。  2022-02-20 10:09:29   \n",
       "4                                加大校外培训机构整顿  2022-02-20 10:11:10   \n",
       "...                                     ...                  ...   \n",
       "1683                                   教育公平  2022-02-17 21:50:24   \n",
       "1684  双减减的还是社会底层的孩子，补课费更贵了，普通人补不起了，有钱的还是照补。  2022-02-17 21:50:34   \n",
       "1685                                 孩子有好出路  2022-02-17 21:50:18   \n",
       "1686                                   更加完善  2022-02-17 21:49:19   \n",
       "1687                              孩子可以上好的大学  2022-02-17 21:41:47   \n",
       "\n",
       "                     提交时间    答题时长     IP省份  IP城市            IP地址  \\\n",
       "0     2022-02-20 10:13:05  03分39秒      上海市   上海市   183.193.63.85   \n",
       "1     2022-02-20 10:13:27  03分01秒      浙江省   杭州市   36.18.246.241   \n",
       "2     2022-02-20 10:13:35  03分09秒      广东省   广州市  117.136.40.146   \n",
       "3     2022-02-20 10:14:09  04分40秒     黑龙江省  双鸭山市     113.5.16.14   \n",
       "4     2022-02-20 10:14:13  03分03秒      浙江省   湖州市   101.70.139.26   \n",
       "...                   ...     ...      ...   ...             ...   \n",
       "1683  2022-02-17 21:58:37  08分13秒      河北省   邯郸市   106.115.8.250   \n",
       "1684  2022-02-17 21:58:48  08分14秒      江西省  景德镇市  120.206.172.48   \n",
       "1685  2022-02-17 21:59:02  08分44秒  广西壮族自治区   南宁市  223.104.91.105   \n",
       "1686  2022-02-17 21:59:27  10分08秒      NaN   NaN     39.144.3.73   \n",
       "1687  2022-02-17 22:05:27  23分40秒      四川省   成都市   223.104.9.150   \n",
       "\n",
       "                       浏览器                 操作系统  area  \n",
       "0     Chrome 86.0.4240.198            Windows 7   上海市  \n",
       "1      Chrome 88.0.4324.93     Android Linux 10   河南省  \n",
       "2      Chrome 86.0.4240.99  Android Linux 8.1.0   广东省  \n",
       "3      Chrome 86.0.4240.99     Android Linux 10   辽宁省  \n",
       "4     Chrome 86.0.4240.198            Windows 7   辽宁省  \n",
       "...                    ...                  ...   ...  \n",
       "1683   Chrome 88.0.4324.93     Android Linux 10   河北省  \n",
       "1684   Chrome 55.0.2883.91  Android Linux 7.1.2   江西省  \n",
       "1685  Chrome 65.0.3325.110  Android Linux 8.1.0   河南省  \n",
       "1686  Chrome 83.0.4103.106     Android Linux 11   广东省  \n",
       "1687  Chrome 86.0.4240.198           Windows 10   四川省  \n",
       "\n",
       "[1688 rows x 39 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# df.groupby(['area']).mean().to_excel('IPA_datas.xlsx')\n",
    "\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "def entropyWeight(data):\n",
    "\tdata = np.array(data)\n",
    "\t# 归一化\n",
    "\tP = data / data.sum(axis=0)\n",
    "\n",
    "\t# 计算熵值\n",
    "\tE = np.nansum(-P * np.log(P) / np.log(len(data)), axis=0)\n",
    "\n",
    "\t# 计算权系数\n",
    "\treturn (1 - E) / (1 - E).sum()\n",
    "    \n",
    "def topsis(data, weight=None):\n",
    "\t# 归一化\n",
    "\tdata = data / np.sqrt((data ** 2).sum())\n",
    "\n",
    "\t# 最优最劣方案\n",
    "\tZ = pd.DataFrame([data.min(), data.max()], index=['负理想解', '正理想解'])\n",
    "\n",
    "\t# 距离\n",
    "\tweight = entropyWeight(data) if weight is None else np.array(weight)\n",
    "\tResult = data.copy()\n",
    "\tResult['正理想解'] = np.sqrt(((data - Z.loc['正理想解']) ** 2 * weight).sum(axis=1))\n",
    "\tResult['负理想解'] = np.sqrt(((data - Z.loc['负理想解']) ** 2 * weight).sum(axis=1))\n",
    "\n",
    "\t# 综合得分指数\n",
    "\tResult['综合得分指数'] = Result['负理想解'] / (Result['负理想解'] + Result['正理想解'])\n",
    "\tResult['排序'] = Result.rank(ascending=False)['综合得分指数']\n",
    "\n",
    "\treturn Result, Z, weight\n",
    "\t# return Result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>综合得分指数</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>area</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>上海市</th>\n",
       "      <td>0.728449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云南省</th>\n",
       "      <td>0.589318</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>内蒙古自治区</th>\n",
       "      <td>0.730654</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京市</th>\n",
       "      <td>0.717787</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>吉林省</th>\n",
       "      <td>0.681692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>四川省</th>\n",
       "      <td>0.629897</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天津市</th>\n",
       "      <td>0.463148</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>宁夏回族自治区</th>\n",
       "      <td>0.777333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>安徽省</th>\n",
       "      <td>0.689046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山东省</th>\n",
       "      <td>0.702501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山西省</th>\n",
       "      <td>0.561069</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东省</th>\n",
       "      <td>0.718536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广西壮族自治区</th>\n",
       "      <td>0.425760</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新疆维吾尔自治区</th>\n",
       "      <td>0.687553</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏省</th>\n",
       "      <td>0.656409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江西省</th>\n",
       "      <td>0.600584</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河北省</th>\n",
       "      <td>0.640066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河南省</th>\n",
       "      <td>0.719653</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江省</th>\n",
       "      <td>0.722432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>海南省</th>\n",
       "      <td>0.634450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖北省</th>\n",
       "      <td>0.678648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖南省</th>\n",
       "      <td>0.697073</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>甘肃省</th>\n",
       "      <td>0.661690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>福建省</th>\n",
       "      <td>0.685332</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西藏自治区</th>\n",
       "      <td>0.681785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贵州省</th>\n",
       "      <td>0.749808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>辽宁省</th>\n",
       "      <td>0.727644</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆市</th>\n",
       "      <td>0.633239</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>陕西省</th>\n",
       "      <td>0.716729</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>青海省</th>\n",
       "      <td>0.867797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>香港特别行政区</th>\n",
       "      <td>0.795029</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>黑龙江省</th>\n",
       "      <td>0.741185</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            综合得分指数\n",
       "area              \n",
       "上海市       0.728449\n",
       "云南省       0.589318\n",
       "内蒙古自治区    0.730654\n",
       "北京市       0.717787\n",
       "吉林省       0.681692\n",
       "四川省       0.629897\n",
       "天津市       0.463148\n",
       "宁夏回族自治区   0.777333\n",
       "安徽省       0.689046\n",
       "山东省       0.702501\n",
       "山西省       0.561069\n",
       "广东省       0.718536\n",
       "广西壮族自治区   0.425760\n",
       "新疆维吾尔自治区  0.687553\n",
       "江苏省       0.656409\n",
       "江西省       0.600584\n",
       "河北省       0.640066\n",
       "河南省       0.719653\n",
       "浙江省       0.722432\n",
       "海南省       0.634450\n",
       "湖北省       0.678648\n",
       "湖南省       0.697073\n",
       "甘肃省       0.661690\n",
       "福建省       0.685332\n",
       "西藏自治区     0.681785\n",
       "贵州省       0.749808\n",
       "辽宁省       0.727644\n",
       "重庆市       0.633239\n",
       "陕西省       0.716729\n",
       "青海省       0.867797\n",
       "香港特别行政区   0.795029\n",
       "黑龙江省      0.741185"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# df1=df.groupby(['area'])\n",
    "# for i, j in df1:\n",
    "#     print(i, topsis(j.iloc[:,23:26]))\n",
    "\n",
    "df_m = topsis(df.iloc[:,23:26])[0]\n",
    "df_m['area'] = df['area']\n",
    "df_m = pd.DataFrame(df_m.groupby(['area']).mean()['综合得分指数'])\n",
    "df_m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>综合得分指数</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>area</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>上海市</th>\n",
       "      <td>0.758346</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云南省</th>\n",
       "      <td>0.697468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>内蒙古自治区</th>\n",
       "      <td>0.706248</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京市</th>\n",
       "      <td>0.736512</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>吉林省</th>\n",
       "      <td>0.687949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>四川省</th>\n",
       "      <td>0.689755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天津市</th>\n",
       "      <td>0.728748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>宁夏回族自治区</th>\n",
       "      <td>0.830135</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>安徽省</th>\n",
       "      <td>0.720186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山东省</th>\n",
       "      <td>0.787094</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山西省</th>\n",
       "      <td>0.677162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广东省</th>\n",
       "      <td>0.753446</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广西壮族自治区</th>\n",
       "      <td>0.637016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新疆维吾尔自治区</th>\n",
       "      <td>0.669711</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江苏省</th>\n",
       "      <td>0.749795</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>江西省</th>\n",
       "      <td>0.650725</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河北省</th>\n",
       "      <td>0.699217</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>河南省</th>\n",
       "      <td>0.745124</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>浙江省</th>\n",
       "      <td>0.731005</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>海南省</th>\n",
       "      <td>0.680082</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖北省</th>\n",
       "      <td>0.729676</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>湖南省</th>\n",
       "      <td>0.722868</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>甘肃省</th>\n",
       "      <td>0.626277</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>福建省</th>\n",
       "      <td>0.771196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西藏自治区</th>\n",
       "      <td>0.740024</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贵州省</th>\n",
       "      <td>0.802664</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>辽宁省</th>\n",
       "      <td>0.748060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆市</th>\n",
       "      <td>0.733893</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>陕西省</th>\n",
       "      <td>0.762637</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>青海省</th>\n",
       "      <td>0.892401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>香港特别行政区</th>\n",
       "      <td>0.880797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>黑龙江省</th>\n",
       "      <td>0.732944</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            综合得分指数\n",
       "area              \n",
       "上海市       0.758346\n",
       "云南省       0.697468\n",
       "内蒙古自治区    0.706248\n",
       "北京市       0.736512\n",
       "吉林省       0.687949\n",
       "四川省       0.689755\n",
       "天津市       0.728748\n",
       "宁夏回族自治区   0.830135\n",
       "安徽省       0.720186\n",
       "山东省       0.787094\n",
       "山西省       0.677162\n",
       "广东省       0.753446\n",
       "广西壮族自治区   0.637016\n",
       "新疆维吾尔自治区  0.669711\n",
       "江苏省       0.749795\n",
       "江西省       0.650725\n",
       "河北省       0.699217\n",
       "河南省       0.745124\n",
       "浙江省       0.731005\n",
       "海南省       0.680082\n",
       "湖北省       0.729676\n",
       "湖南省       0.722868\n",
       "甘肃省       0.626277\n",
       "福建省       0.771196\n",
       "西藏自治区     0.740024\n",
       "贵州省       0.802664\n",
       "辽宁省       0.748060\n",
       "重庆市       0.733893\n",
       "陕西省       0.762637\n",
       "青海省       0.892401\n",
       "香港特别行政区   0.880797\n",
       "黑龙江省      0.732944"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.iloc[:,9:13]\n",
    "df_q = topsis(df.iloc[:, 9:13])[0]\n",
    "df_q['area'] = df['area']\n",
    "df_q = pd.DataFrame(df_q.groupby(['area']).mean()['综合得分指数'])\n",
    "df_q"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "dfmq = pd.concat([df_m, df_q], axis=1)\n",
    "dfmq.columns=['topsis_m', 'topsis_q']\n",
    "dfmq.to_csv('./topsis_m_q.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c3ac3f88986c03f5f4ea9b167d463bfb61b25cb597313235fabe727a0f7e0da2"
  },
  "kernelspec": {
   "display_name": "Python 3.9.5 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
